import matplotlib.pyplot as plt
from randomwalk import RandomWalk
while True:
    rw =RandomWalk(50000)#创造一个实例
    rw.fill_walk()

    plt.style.use("fivethirtyeight")
    fig,ax=plt.subplots(figsize=(15,9))
    point_numbers=range(rw.num_points)
    ax.scatter(rw.x_values,rw.y_values,c=point_numbers,cmap=plt.cm.Reds,s=1)
    ax.scatter(0,0,c="green",edgecolors="none",s=100)
    ax.scatter(rw.x_values[-1],rw.y_values[-1],c="blue",edgecolors="none",s=100)
    #隐藏坐标轴
    ax.get_xaxis().set_visible(False)
    ax.get_yaxis().set_visible(False)
    ax.set_aspect("equal")#让x轴和y轴的刻度间距相等。
    plt.show()

    keep_running=input("Make another walk?(y/n):")

    if keep_running =="n":
        break